<?php

/**
 * HistoriquePrixArticle form base class.
 *
 * @method HistoriquePrixArticle getObject() Returns the current form's model object
 *
 * @package    symfony
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseHistoriquePrixArticleForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'id_article'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
      'id_user'          => new sfWidgetFormInputText(),
      'id_t_v_a'         => new sfWidgetFormInputText(),
      'prix_vente_t_t_c' => new sfWidgetFormInputText(),
      'prix_vente_h_t'   => new sfWidgetFormInputText(),
      'prix_achat_t_t_c' => new sfWidgetFormInputText(),
      'prix_achat_h_t'   => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'id_article'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'))),
      'id_user'          => new sfValidatorInteger(),
      'id_t_v_a'         => new sfValidatorInteger(),
      'prix_vente_t_t_c' => new sfValidatorNumber(array('required' => false)),
      'prix_vente_h_t'   => new sfValidatorNumber(array('required' => false)),
      'prix_achat_t_t_c' => new sfValidatorNumber(array('required' => false)),
      'prix_achat_h_t'   => new sfValidatorNumber(array('required' => false)),
      'created_at'       => new sfValidatorDateTime(),
      'updated_at'       => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('historique_prix_article[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'HistoriquePrixArticle';
  }

}
